import Vue from 'vue'
//引入vue-router
import VueRouter from 'vue-router';
//引用page1页面
import Layout from '@/components/Layout';
import Home from '@/components/Home';
import Base from '@/components/Base';
import Regression from '@/components/Regression';
import ScheduleTimeTask from '@/components/ScheduleTimeTask';
import Police from '@/components/Police.vue';
import Version from '@/components/Version.vue';
import LogManage from '@/components/LogManage.vue';
import CaseManage from '@/components/CaseManage.vue';
import UserManage from '@/components/UserManage.vue';
import Login from '@/components/Login.vue';
import Tips from '@/components/Tips.vue';  // 没有权限提示页面

Vue.use(VueRouter);
//定义routes路由的集合，数组类型
const routes = [
    //单个路由均为对象类型，path代表的是路径，component代表组件
    {
        path: '/login',
        components: {
            all_view: Login,
        }
    },
    {
        path: '/',
        components: {
            all_view: Layout,
        },
        children: [
            {
                path: '/',
                components: {layout: Home},
            },
            {
                path: '/base',
                components: {layout: Base},
            },
            {
                path: '/regression',
                components: {layout: Regression},
            },
            {
                path: '/schedule_time_task',
                components: {layout: ScheduleTimeTask},
            },
            {
                path: '/police',
                components: {layout: Police},
            },
            {
                path: '/version',
                components: {layout: Version},
            },
            {
                path: '/log_manage',
                components: {layout: LogManage},
            },
            {
                path: '/user_manage',
                components: {layout: UserManage},
            },
            {
                path: '/case_manage',
                components: {layout: CaseManage},
            },
            {
                path: '/login',
                components: {layout: Login},
            },
            {
                path: '/tips',
                components: {layout: Tips},
            },
        ]
    },
]

//实例化VueRouter并将routes添加进去
const router = new VueRouter({
    // 指定路由选中时的样式类名
    linkActiveClass: 'active',
    mode: 'history',  // 去掉 #
    routes
});

//抛出这个这个实例对象方便外部读取以及访问
export default router